package com.dachuang.canjiren.controller;


import com.dachuang.canjiren.service.CommentService;
import com.dachuang.canjiren.service.LawCommentService;
import com.dachuang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/canjiren/law-comment")
public class LawCommentController {

    @Autowired
    private LawCommentService lawCommentService;

    /**
     * 插入法律评论
     * @param lawId
     * @param content
     * @param parId
     * @param userId
     * @return
     */
    @GetMapping(value = "insertLawComment")
    R insertLawComment(
            @RequestParam(value = "lawId", required = false) Integer lawId,
            @RequestParam(value = "content", required = false) String content,
            @RequestParam(value = "parId", required = false) Integer parId,
            @RequestParam(value = "userId", required = false) Integer userId) {
        return lawCommentService.insertLawComment(lawId, content, parId, userId);
    }

    @GetMapping(value = "LawCommentlist")
    R LawCommentlist(@RequestParam(value = "lawId", required = false) Integer lawId) {
        return lawCommentService.selectLawCommentList(lawId);
    }
}

